package org.yonggan.dmp.utils

import org.yonggan.dmp.conf.ConfigManager
import redis.clients.jedis.JedisPool

/**
  * redis连接池
  */
object JedisPoolUtils {

  private  lazy val jedisPool = new JedisPool(ConfigManager.REDIS_HOST,ConfigManager.REDIS_PORT)


  /**
    * 提取 redis 连接
    * @param dbIdx
    * @return
    */
  def getJedis(dbIdx:Int) = {
    val jedis = jedisPool.getResource
    jedis.select(dbIdx)
    jedis
  }

}
